//
// Created by lymk on 2022/2/26.
//

#ifndef SOFTRENDER_WINDOWSAPPLICATION_H
#define SOFTRENDER_WINDOWSAPPLICATION_H

#include <windows.h>
#include <windowsx.h>
#include <cstdint>
#include <string>
#include "GameTimer.h"
#include "InputManager.h"
#include "RenderPipeline.h"

class WindowsApplication {
public:
    WindowsApplication();
    WindowsApplication(std::string name,uint32_t height,uint32_t width);

    virtual int Initialize();
    virtual void Finalize();
    // One cycle of the main loop
    virtual void Tick(GameTimer* mTimer);
    //Action == 1 up ==0 down

    // the WindowProc function prototype
    static LRESULT CALLBACK WindowProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);

    inline HWND getMainWindow() { return m_hWnd; };

    uint32_t getScreenWidth() const;

    void setScreenWidth(uint32_t screenWidth);

    uint32_t getScreenHeight() const;

    void setScreenHeight(uint32_t screenHeight);

    inline RenderPipeline* getRenderPipeline(){
        return renderPipeline;
    }

    static bool bShouldClose;
private:
    HWND m_hWnd;
    HDC m_hDc;
    HDC m_bufDc;
    InputManager* inputManager;
    std::string appName;
    RenderPipeline* renderPipeline;
    uint32_t screenWidth;
    uint32_t screenHeight;
};


#endif //SOFTRENDER_WINDOWSAPPLICATION_H
